


<template>
  <view class="my-container">
    <!-- 头部信息 -->
    <view class="profile-header">
      <view class="avatar-box">
        <image class="avatar" src="https://bigironcollision.obs.cn-east-3.myhuaweicloud.com:443/temp%2Ftx_1757241357597.png" mode="aspectFill"></image>
      </view>
      <view class="info-box">
        <text class="shop-name">{{userInfo.storeName}}</text>
        <text class="staff-account">{{userInfo.realname}}</text>
      </view>
    </view>

    <!-- 订单统计 -->
    <view class="order-stats">
      <view class="stats-card">
        <view class="stat-item">
          <text class="stat-title">霸王餐订单(总)</text>
          <text class="stat-value">{{orderInfo.bwcCount}}</text>
        </view>
        <view class="stat-item">
          <text class="stat-title">霸王餐订单(今日)</text>
          <text class="stat-value today">{{orderInfo.bwcNowCount}}</text>
        </view>
      </view>
      
      <view class="stats-card">
        <view class="stat-item">
          <text class="stat-title">秒杀订单(总)</text>
          <text class="stat-value">{{orderInfo.msCount}}</text>
        </view>
        <view class="stat-item">
          <text class="stat-title">秒杀订单(今日)</text>
          <text class="stat-value today">{{orderInfo.msNowCount}}</text>
        </view>
      </view>
    </view>

    <!-- 操作列表 -->
    <view class="action-list">
      <view class="action-item" @click="navigateTo('tcList')">
        <view class="action-left">
          <image class="action-icon" src="../../static/tc.png"></image>
          <text class="action-text">查看套餐</text>
        </view>
        <image class="arrow" src="../../static/icon_arrow_right.png"></image>
      </view>
      
      <view class="action-item" @click="navigateTo('account')" v-if="userInfo.type==1">
        <view class="action-left">
          <image class="action-icon" src="../../static/cy.png"></image>
          <text class="action-text">管理员工</text>
        </view>
        <image class="arrow" src="../../static/icon_arrow_right.png"></image>
      </view>
      
      <view class="action-item" @click="navigateTo('editPass')">
        <view class="action-left">
          <image class="action-icon" src="../../static/xiugai.png"></image>
          <text class="action-text">修改密码</text>
        </view>
        <image class="arrow" src="../../static/icon_arrow_right.png"></image>
      </view>
	  <!-- <view class="action-item" @click="navigateTo('export')">
	    <view class="action-left">
	      <image class="action-icon" src="/../../static/tc.png"></image>
	      <text class="action-text">导出数据</text>
	    </view>
	    <image class="arrow" src="../../static/icon_arrow_right.png"></image>
	  </view> -->
      
      <view class="action-item" @click="logout">
        <view class="action-left">
          <image class="action-icon" src="../../static/tuichu.png"></image>
          <text class="action-text">退出登录</text>
        </view>
        <image class="arrow" src="../../static/icon_arrow_right.png"></image>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      userInfo: '',
      stats: {
        freeMealTotal: 128,
        freeMealToday: 12,
        seckillTotal: 356,
        seckillToday: 42
      },
	  orderInfo:'',
    }
  },
  onLoad() {
  	
  },
  onShow() {
	  this.userInfo= uni.getStorageSync("userInfo")
  	this.queryBicOrderCount()
  },
  methods: {
	queryBicOrderCount(){
		uni.showLoading({
			title: '加载中'
		})
		this.$http('jeecg-boot/app/market/bicOrder/queryBicOrderCount',{
		   storeId:this.userInfo.storeId,
		  
		},'POST').then(res => {
				   //console.log(res)
			 uni.hideLoading();
			 this.orderInfo=res.result
		
			 //this.queryByOrderId()
			 
			 
		 })
	},
    // 导航到对应页面
    navigateTo(page) {
    
        uni.navigateTo({
          url: page
        })
      
    },
    
    // 退出登录
    logout() {
      uni.showModal({
        title: '提示',
        content: '确定要退出登录吗？',
        success: (res) => {
          if (res.confirm) {
            uni.showLoading({ title: '正在退出...' })
			uni.clearStorageSync();
            // 这里调用退出登录接口
            setTimeout(() => {
              uni.reLaunch({
                url: '../index/login'
              })
            }, 1000)
          }
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.my-container {
  padding-bottom: 30px;
  background-color: #f7f7f7;
  min-height: 100vh;
}

/* 头部信息 */
.profile-header {
  display: flex;
  align-items: center;
  padding: 30px 20rpx;
  background: linear-gradient(to right, #4e8cff, #3a6cd9);
  color: #fff;
  padding-bottom: 100rpx;
  .avatar-box {
    margin-right: 15px;
    
    .avatar {
      width: 70px;
      height: 70px;
      border-radius: 50%;
      border: 3px solid rgba(255,255,255,0.3);
    }
  }
  
  .info-box {
    display: flex;
    flex-direction: column;
    
    .shop-name {
      font-size: 18px;
      font-weight: bold;
      margin-bottom: 5px;
    }
    
    .staff-account {
      font-size: 14px;
      opacity: 0.9;
    }
  }
}

/* 订单统计 */
.order-stats {
  display: flex;
  justify-content: space-between;
  padding: 20rpx;
  margin-top: -100rpx;
  .stats-card {
    width: 40%;
    background-color: #fff;
    border-radius: 8px;
    padding: 20rpx;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    
    .stat-item {
      margin-bottom: 10px;
      
      &:last-child {
        margin-bottom: 0;
      }
      
      .stat-title {
        display: block;
        font-size: 12px;
        color: #999;
        margin-bottom: 3px;
      }
      
      .stat-value {
        font-size: 18px;
        font-weight: bold;
        color: #333;
        
        &.today {
          color: #FF5A5F;
        }
      }
    }
  }
}

/* 操作列表 */
.action-list {
  margin: 20rpx;
  margin-top: 10rpx;
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  
  .action-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    
    &:last-child {
      border-bottom: none;
    }
    
    .action-left {
      display: flex;
      align-items: center;
    }
    
    .action-icon {
      width: 22px;
      height: 22px;
      margin-right: 10px;
    }
    
    .action-text {
      font-size: 15px;
      color: #333;
    }
    
    .arrow {
      width: 12rpx;
      height: 20rpx;
     /* opacity: 0.5; */
    }
  }
}
</style>